package ca.etsmtl.log430.lab1;

public class RoleList extends List  {

	public RoleList()  {
		super();
	}
	/**
	 * @param role
	 *            New role to be added to the list. All the issues of casting
	 *            are taken care of within this class.
	 */
	public void addRole(String role) {
		if(role != null && !role.isEmpty() && !contains(role))
		appendItemToList((Object) role);
	}
	/**
	 * @return The role pointed at the current position pointed to by the
	 *         internal list pointer of the internal list. Subsequent calls will
	 *         return the next Project object in the list. A null object is
	 *         returned if list is empty or the end of list has been reached.
	 */
	public String getNextRole() {
		return (String) getItemFromList();
	}
	public Boolean contains(String role)
	{
		String currentObject;
		boolean done = false;

		goToFrontOfList();

		while (!done) {

			currentObject = getNextRole();

			if (currentObject == null) {

				done = true;

			} else if(currentObject.equals(role)){
				return true;
			} // if

		} // while

		return false;
	}
}
